﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="volva.Models" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>Leitarniðurstöður</h1>
    
           <div class="frontpagelists">
           <table>
                <tr>
                    <th>Mynd </th>
                    <th>Þáttur </th>
                    <th>Stöð </th>
                </tr>
    <%
        List<Video> video = ViewData["VideoResults"] as List<Video>;
            foreach (Video v in video)
            {
                string image = (String.IsNullOrEmpty(v.thumbnail + "") == true ?  "/Content/Images/default_thumb.jpg" : v.thumbnail.ToString());
                Response.Write("<tr>");
                Response.Write( "<td><img src='" + image + "' /></td>" + 
                                "<td><a href='/Home/Watch/" + v.id + "'>" + v.name + "</a></td>" + 
                                "<td><a href='/Station/Details/" + v.Station_id + "'>" + v.Station.name + "<a></td>"); 
                Response.Write("</tr>");
            }
            
	if (video.Count() == 0)
            Response.Write("<tr><td colspan=\"3\">Enginn þáttur</td></tr>");
        
    %>
    </table>
    

            <table>
                <tr>
                    <th>Stöðvar</th>
                </tr>
    <%
        List<Station> stations = ViewData["StationResults"] as List<Station>;

            foreach (Station v in ViewData["StationResults"] as List<Station>)
            {
                Response.Write("<tr>");
                Response.Write("<td><a href='../Station/Details/" + v.id + "'>" + v.name + "</a></td>");
                Response.Write("</tr>");
            }

	if (stations.Count() == 0)
            Response.Write("<tr><td>Enginn stöð</td></tr>");
        
    %>
    </table>

    <table>
        <tr>
            <th>Þáttarröð</th>
            <th>Lýsing</th>
        </tr>
    <%
        List<Series> series = ViewData["SeriesResults"] as List<Series>;

        foreach (Series v in series)
        {
            Response.Write("<tr>");
            Response.Write("<td><a href='Serie/" + v.id + "'>" + v.name + "</a></td><td>" + v.description + "</td>");
            Response.Write("</tr>");
        }

	if (series.Count() == 0)
            Response.Write("<tr><td colspan=\"2\">Enginn sería</td></tr>");
        
    %>
    </table>
    
</asp:Content>
